package com.tcloudit.common.core.web.domain;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

public class PageEntity<T> implements Serializable {

    private static final long serialVersionUID = 1L;

    private T key;
    @NotNull(message = "分页参数为空")
    @Min(value = 0, message = "分页参数不能小于零")
    private Integer page;

    @NotNull(message = "分页参数为空")
    @Min(value = 0, message = "分页参数不能小于零")
    private Integer size;

    public Boolean isEmpty(){
        return this.page == null || this.size == null;
    }

    public PageEntity() {
    }

    public PageEntity(T key, Integer page, Integer size) {
        this.key = key;
        this.page = page;
        this.size = size;
    }

    public T getKey() {
        return key;
    }

    public void setKey(T key) {
        this.key = key;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Integer getSize() {
        return size;
    }

    public void setSize(Integer size) {
        this.size = size;
    }
}
